﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SubPolicy.aspx.cs" Inherits="Web.SubPolicy" %>

<%@ Register TagPrefix="uc1" TagName="TopMenu" Src="TopMenu.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Floor" Src="Floor.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>子策略管理 | 海淀区学校素质评测管理平台</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <link href="js/boxy/stylesheets/boxy.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="js/boxy/javascripts/jquery.boxy.js" type="text/javascript"></script>
    <script src="js/module.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
    
        function CheckFloat(str)    
        {           
            if (/^(\+|-)?\d+($|\.\d+$)/.test( str ))     
            {    
               return true;    
            }     
            else     
            {      
               return false;    
            }    
        }    
        function CheckNumber(str)
        {
            if(/^\d+$/.test(str))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
       function Save()
       {
             var subId="<% =subId %>";
            if(subId=="" || subId=="0")
            {
                alert("请先选择一种题型策略！");
                return false;
            }
            var name = window.document.forms["BookMaster"]["tbName"].value;
            if(name==null || name=="")
            {
                alert("请输入名称！");
                return false;
            }
            var order = window.document.forms["BookMaster"]["tbOrder"].value;
            if(order==null || order=="")
            {
               alert("请输入顺序号！"); 
               return false;
            }
            else
            {
                if(!CheckNumber(order))
                {
                    alert("请输入数字！"); 
                    return false;
                }
            }
            var questionType = window.document.forms["BookMaster"]["drpQuestionType"].value;
            if(questionType==null || questionType=="")
            {
                alert("请选择题型！"); 
                return false;
            }
            
            var allScore = window.document.forms["BookMaster"]["tbAllScore"].value;
            if(allScore==null || allScore=="")
            {
               alert("请输入总分！"); 
               return false;
            }
            else
            {
                if(!CheckNumber(allScore))
                {
                    alert("请输入数字！"); 
                    return false;
                }
            }
            
            var allCount = window.document.forms["BookMaster"]["tbAllCount"].value;
            if(allCount==null || allCount=="")
            {
               alert("请输入题目个数！"); 
               return false;
            }
            else
            {
                if(!CheckNumber(allCount))
                {
                    alert("请输入数字！"); 
                    return false;
                }
            }
            
            return true;
        }
        function SetSelectedCss()
        {
           var subId="<% =subId %>";
           if(subId!="" && subId!="0")
           {
                var obj =window.document.getElementById("sub"+subId);
                if(obj!=null)
                {
                    obj.style.color="red"; 
                }
           }
        }
        function AddToSelect(formid,selectId,value,text)
        {
            var selectObj = window.document.forms[formid][selectId];
            var optionItem = window.document.createElement("OPTION");
            optionItem.text = text;
            optionItem.value = value;
            selectObj.options.add(optionItem, 0);
        }
        function RemoveSelect(formid, selectId, value)
        {
            var selectObj = window.document.forms[formid][selectId];
            for (var i = selectObj.options.length - 1; i >= 0; i--)
            {
                if(selectObj.options[i].value==value)
                {
                    selectObj.remove(i);
                }
            }
        }
        function RemoveAllSelect(formid, selectId)
        {
            var selectObj = window.document.forms[formid][selectId];
            for (var i = selectObj.options.length - 1; i >= 0; i--)
            {
                selectObj.remove(i);
            }
        }
        function OnSucceeded(result) 
        {
            if(result=="exist")
            {
                alert("已存在相同的名称！");
            }
            else if(result=="ok")
            {
                alert('成功!');
            }
            else if(result=="failure")
            {
                alert('失败!');
            }
        }
        function Refresh()
        {
            window.document.getElementById("btnSearch").click();
        }
        function SetRepeater(value)
        {
            window.document.forms["BookMaster"]["tbRepeater"].value =value;
        }
    </script>

</head>
<body>
    <uc1:TopMenu ID='menu1' runat='server'></uc1:TopMenu>
    <div id="main">
        <form id="BookMaster" runat="server">
        <div id="block">
            <div id="blocktitle">
                <h3>
                    子策略管理</h3>
                <em>[&nbsp;<a href="javascript:ShowIframe('SubPolicyUpdate.aspx?mainId=<% =mainId %>','新建子策略',500,200);">新建子策略</a>
                    |&nbsp;<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">返回</asp:LinkButton>
                    ] </em>
                <input id="btnSearch" type="button" value="button" runat="server" onserverclick="btnSearch_Click" style="visibility:hidden; display:none;" />
            </div>
            <div id="blockcontent">
                <asp:Label ID="lbQuestionType" runat="server"></asp:Label>
            </div>
        </div>
        <div id="block" align="center" >
            <table cellpadding="0" cellspacing="1" class="table_edit">
                <tbody>
                    <tr align="left">
                        <td>
                            名称
                        </td>
                        <td>
                            <input name="tbName" id="tbName" runat="server" style="width:300px;" type="text" size="30" maxlength="20"
                                class="left" />
                        </td>
                        <td style="width:40px">
                        
                        </td>
                        <td>
                            题型
                        </td>
                        <td>
                            <asp:DropDownList ID="drpQuestionType" runat="server"  
                                Width="306px">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr align="left">
                        <td>
                            总分
                        </td>
                        <td>
                            <asp:TextBox ID="tbAllScore" Width="300px" runat="server"></asp:TextBox>
                        </td>
                        <td style="width:40px">
                        
                        </td>
                        <td>
                            题目个数
                        </td>
                        <td>
                            <asp:TextBox ID="tbAllCount" Width="300px" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr align="left">
                        <td>
                            每题分值
                        </td>
                        <td>
                            <asp:TextBox ID="tbSingleScore" Width="300px" runat="server"></asp:TextBox>
                        </td>
                        <td style="width:40px">
                        
                        </td>
                        <td>
                            顺序
                        </td>
                        <td>
                            <input name="tbOrder" id="tbOrder" style="width: 300px;" runat="server" type="text"
                                size="5" maxlength="10" class="left" />
                        </td>
                    </tr>
                     <tr align="left">
                       <td>
                            重复度：
                       </td>
                        <td colspan="4">
                            <asp:TextBox ID="tbRepeater" runat="server" ReadOnly="True" Width="680px"></asp:TextBox>
                            &nbsp;&nbsp;
                            <a href="javascript:ShowIframe('SubPolicyQuestionRepeat.aspx?subId=<% =subId %>','重复度选择',350,140);">选择</a>
                        </td>
                        
                    </tr>
                    <tr align="left">
                        <td>
                            难度系数
                        </td>
                        <td>
                            <asp:ListBox ID="lbDiff" runat="server" Width="300px" Height="280px"></asp:ListBox>
                            <a href="javascript:ShowIframe('SubPolicyDiff.aspx?subId=<% =subId %>','难度选择',600,300);">选择</a>
                        </td>
                        <td style="width:40px">
                        
                        </td>
                        <td rowspan="2">
                            知识点
                        </td>
                        <td rowspan="2">
                            <asp:ListBox ID="lbKownPoint" Width="280px" runat="server" Height="280px"></asp:ListBox>
                            <a href="javascript:ShowIframe('SubPolicyKnow.aspx?subId=<% =subId %>&SubjectId=<% =SubjectId %>','知识点选择',860,500);">选择</a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div id='blockfloor' align="center">
            <asp:Button ID="btnSave" runat="server" OnClientClick="return Save();" Text="保存"  Width="100px" 
                onclick="btnSave_Click" />
        </div>
        <script language="javascript" type="text/javascript">
        SetSelectedCss();
        </script>

        </form>
    </div>
    <uc1:Floor ID='Floor1' runat='server'></uc1:Floor>
</body>
</html>
